CC ?= gcc

TARGET_CFLAGS ?= -Wall -g -Iinc/ -I. $(CFLAGS) -pthread -ansi -pedantic
TARGET_CLIBS ?= -g $(CLIBS) -pthread -lm
TARGET_LDFLAGS ?= -g $(LDFLAGS)

SERVER_CLIBS=$(TARGET_CLIBS)

CLIENT_CLIBS=$(TARGET_CLIBS) -lGL -lXxf86vm -lX11 -lpng $(shell freetype-config --libs)

PREFIX ?= /usr

include Makefile.base
include Makefile.posixinstall

$(TARGET): $(CLIENTOBJS)
	$(CC) -o $(TARGET) $(CLIENTOBJS) $(CLIENT_CLIBS)

$(TARGET)-server: $(SERVEROBJS)
	$(CC) -o $(TARGET)-server $(SERVEROBJS) $(SERVER_CLIBS)

install:
	@echo "no install support"

uninstall:
	@echo "no uninstall support"

package:
	@echo "no package support"

$(GLDIR)/font_ttf.o: $(GLDIR)/font_ttf.c
	$(CC) $(TARGET_CFLAGS) $(shell freetype-config --cflags) $(CFLAG_DEFS) -o $@ -c $<

.PHONY: install uninstall package
